#include<iostream>
#include "Player.h"
#include "stdafx.h"


class Player{

public:

	Player::Player(){
		inventory = new Inventory();
		static int numItems = 0;
		moves = 0;
		weightCapacity = 6;
		hunger = 0;
		health = 5;
	}
	//Deconstructor
	Player::~Player (){

	}
	//PosX Mutators
	static int Player::GetPosX (){
		return posX;
	}	
	static void Player::SetPosX (int value){
		posX = value;
	}
	//PosY Mutators
	static int Player::GetPosY (){
		return posY;
	}
	static void Player::SetPosY (int value){
		posY = value;
	}
	//PosZ Mutators
	static int Player::GetPosZ(){
		return posZ;
	}
	static void Player::SetPosZ (int value){
		posZ = value;
	}
	//PrevPosX Mutators
	static int Player::GetPrevPosX (){
		return prevPosX;
	}
	static void Player::SetPrevPosX (int value){
		prevPosX = value;
	}
	//PrevPosY Mutators
	static int Player::GetPrevPosY (){
		return prevPosY;
	}
	static void Player::SetPrevPosY (int value){
		prevPosY = value;
	}
	//PrevPosZ Mutators
	static int Player::GetPrevPosZ(){
		return prevPosZ;
	}
	static void Player::SetPrevPosZ (int value){
		prevPosZ = value;
	}
	//Moves Mutators
	static int Player::GetMoves(){
		return moves;
	}
	static void Player::SetMoves(int value){
		moves = value;
	}
	static void Player::Move(string direction){
		Room currentRoom = GetCurrentRoom();
	
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;

		if(!currentRoom.CanExit(direction){
			cout << "Invalid direction" << endl;
			return;
		}

		moves++;
		if (Player.moves % 20 == 0)
                Player.hunger++;

            switch (direction)
            {
                case Direction.North:
                    posZ--;
                    break;
                case Direction.South:
                    posZ++;
                    break;
                case Direction.East:
                    posX++;
                    break;
                case Direction.West:
                    posX--;
                    break;
                case Direction.Up:
                    posY++;
                    break;
                case Direction.Down:
                    posY--;
                    break;
            }

            GetCurrentRoom().getDescription();
			

	}
	//WeightCapacity Mutators
	static int Player::GetWeightCapacity(){
		return weightCapacity;
	}
	static void Player::SetWeightCapacity(int value){
		weightCapacity = value;
	}

	static void PickupItem(const string& itemName){
		Room room = GetCurrentRoom();
		Item item = room.GetItem(itemName);

		if(item != (NULL)){
			if(Player::InventoryWeight + item.Weight > Player.weightCapacity){
				cout << "You're over-encumbered! Try dropping some weight before you pick up the new item." << endl;
				return;
			}
			room.Items.Remove(items);
			Player.inventoryItems.add(items);
			numItems++;
			cout << item.PickUpText
		}
		else{
			cout << "There is no item in this room." << endl;
		}
	}

	static void DropItem(const string& name){
		 Room room = Player.GetCurrentRoom();
            Item item = GetInventoryItem(itemName);

            if (item != null)
            {
                Player.inventoryItems.Remove(item);
                Player.numItems--;
                room.Items.Add(item);
                cout << "The " << itemName << " has been dropped into this room." << endl;
            }
            else
            {
                cout << "There is no " << itemName <<" in your inventory." << endl;
            }
	}
	
	static void DisplayInventory(){
		cout << "Your inventory contains: " << endl;
		cout << "_________________________" << endl;
		string items = "";

		 if (inventoryItems.Count > 0)
            {
                for each (Item item in inventoryItems)
                {
                    items += "\n[" + item.Title + "] Wt: " + item.Weight.ToString();
                }
            }
		 else items  = "<no items>";
		
		 items += "Total Wt: " + Player.InventoryWeight + " / " + Player.weightCapacity;

		 cout << items << endl;

	}

	static Room GetCurrentRoom(){
		return Level.rooms[posX, posY, posZ];
	}

	static void DisplayStatus(){

	}

	static void Search(){

	}


private:
	static int posX;
	static int posY;
	static int posZ;

	static int prevPosX;
	static int prevPosY;
	static int prevPosZ;

	static Inventory* inventory;
	static int numItems;
	static int moves;
	static int weightCapacity;
	static int hunger;
	static int health;
};